/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entityBeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author allankv
 */
@Entity
@Table(name = "genus")
@NamedQueries({
    @NamedQuery(name = "Genus.findAll", query = "SELECT g FROM Genus g"),
    @NamedQuery(name = "Genus.findByIdgenus", query = "SELECT g FROM Genus g WHERE g.idgenus = :idgenus"),
    @NamedQuery(name = "Genus.findByGenus", query = "SELECT g FROM Genus g WHERE g.genus = :genus")})
public class Genus implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idgenus")
    private Integer idgenus;
    @Basic(optional = false)
    @Column(name = "genus")
    private String genus;
    @OneToMany(mappedBy = "genus", fetch = FetchType.LAZY)
    private List<Taxonomicelement> taxonomicelementList;

    public Genus() {
    }

    public Genus(Integer idgenus) {
        this.idgenus = idgenus;
    }

    public Genus(Integer idgenus, String genus) {
        this.idgenus = idgenus;
        this.genus = genus;
    }

    public Integer getIdgenus() {
        return idgenus;
    }

    public void setIdgenus(Integer idgenus) {
        this.idgenus = idgenus;
    }

    public String getGenus() {
        return genus;
    }

    public void setGenus(String genus) {
        this.genus = genus;
    }

    public List<Taxonomicelement> getTaxonomicelementList() {
        return taxonomicelementList;
    }

    public void setTaxonomicelementList(List<Taxonomicelement> taxonomicelementList) {
        this.taxonomicelementList = taxonomicelementList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idgenus != null ? idgenus.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Genus)) {
            return false;
        }
        Genus other = (Genus) object;
        if ((this.idgenus == null && other.idgenus != null) || (this.idgenus != null && !this.idgenus.equals(other.idgenus))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityBeans.Genus[idgenus=" + idgenus + "]";
    }

}
